import { Button, message } from "antd"
import { useSelector } from "react-redux";
import { useNavigate } from "react-router-dom";
import { IStore } from "../redux/typings"
/**
 * 添加问答 
 */
function AddIssueBtn() {
    const { isLogin } = useSelector((state: IStore) => state.user)
    const navigate = useNavigate()
    const clickHandle = () => {
        // 如果登录了就可以跳转到问答页面
        if (isLogin) {
            navigate("/addIssue")
        } else {
            message.warning("请先登录")
        }
    }
    return (
        <Button
            type="primary"
            size="large"
            style={{ width: "100%", marginBottom: "30px" }}
            onClick={clickHandle}
        >我要发问</Button>
    );
}

export default AddIssueBtn;